var dh = getItemValueAsString("sqdh_search");
var bm = getItemValueAsString("bm_search");
var sqr = getItemValueAsString("sqr_search");
var ywlx = getItemValueAsString("ywlx_search");
var ywmc = getItemValueAsString("ywmc_search");
var startTime = getItemValueAsString("sqsj_start_search");
var endTime = getItemValueAsString("sqsj_end_search");
var curr_node = getItemValueAsString("curr_node");
var sql = "select * from tlk_setuo_carryout where 1 = 1 ";
if (isNotNull(dh)) {
    sql = sql + " and item_sqdh like '%" + dh + "%' ";
}
if (isNotNull(bm)) {
    sql = sql + " and item_sqbm = '" + bm + "' ";
}
if (isNotNull(ywlx)) {
    sql = sql + " and item_ywlx = '" + ywlx + "' ";
}
if (isNotNull(sqr)) {
    sql = sql + " and item_sqr in ( select id from obpm.t_user where name like '%" + sqr + "%' )";
}
if (isNotNull(ywmc)) {
    sql = sql + " and item_ywmc like '%" + ywmc + "%' ";
}
if (isNotNull(startTime)) {
    sql = sql + " and CREATED  > '" + (startTime + " 00:00:00") + "' ";
}
if (isNotNull(endTime)) {
    sql = sql + " and CREATED  < '" + (endTime + " 00:00:00") + "' ";
}
if (isNotNull(curr_node)) {
    sql = sql + " and STATELABEL = '" + curr_node + "' ";
}
sql = sql + " order by item_sqdh desc";
sql;